﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace WebApplication1.Entity
{
    public class TreeViewHelper
    {
        public TreeViewHelper()
        {
        }

        public static void navigateNodes(TreeNode tnParent, int SchoolId)
        {
            ProcessNode(tnParent, SchoolId);
            if (tnParent.ChildNodes.Count != 0)
            {
                foreach (TreeNode tn in tnParent.ChildNodes)
                {
                    navigateNodes(tn, SchoolId);
                }
            }
        }

        public static void ProcessNode(TreeNode tn, int SchoolId)
        {
            if (tn.Checked == true)
                SQLHelper.AddTagBySchoolId(SchoolId,Convert.ToInt32(tn.Value));
        }
    }
}